<?php 
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
	session_start(); 
}
$lang = $_SESSION['lang'];
if (empty($lang) || $lang == "EN") {
	include "../value/value_en.php";
} else if($lang == "VN") {
	include "../value/value_vn.php";
}
else {
	include "../value/value_kr.php";
}
include '../operations/connection.php';	

$assets=mysql_query("SELECT * FROM assets WHERE id=".$_REQUEST['id_assets']);
$group=0;
$isBorrow=array();
while ($r = mysql_fetch_array($assets)){
	$group=$r['group'];
	$type=$r['type'];
		$isBorrow=array($r['id'],$r['name'],$r['count'],$r['notuse'],$r['stock'],$r['note']);
}
$group_assets=mysql_query("SELECT g.*,(SELECT COUNT(*) FROM assets a WHERE a.group=g.id ) as count FROM group_assets g ORDER BY g.name;");
$groupassets=array();
while ($r = mysql_fetch_array($group_assets)){
		$groupassets[]=array($r['id'],$r['name'],$r['count']);
}
$type_assets=mysql_query("SELECT t.*,(SELECT COUNT(*) FROM assets a WHERE a.type=t.id ) as count FROM type_assets t ORDER BY t.name;");
$typeassets=array();
while ($r = mysql_fetch_array($type_assets)){
		$typeassets[]=array($r['id'],$r['name'],$r['count']);
}
?>
			<input type="hidden" value="<?php echo $isBorrow[0];?>" name="idAssets2" id="idAssets2">
			   <table style=" padding-left:10px;">

							<tr >
								<td class="tdfirst"><?php echo $l_groupassets;?></td>
								<td >
								<select name="groupAssets2" id="groupAssets2" style="font-size: 12px;height: 28px; width: 190px;padding: 4px;">
								<?php 
									$i=0;
									foreach ($groupassets as $value => $giatri)
									{
										?>
										<?php // if($group!=$giatri[0]){?>
									<option value="<?php echo $giatri[0];?>"><?php echo $giatri[1];?></option>
									<?php // }?>
									<?php 
										$i++;
									}
														
									?>
								</select>
							</tr >		
							<tr>
								<td  class="tdfirst"><?php echo $l_typeassets;?></td>
								<td>
								<select name="typeAssets2" id="typeAssets2" style="font-size: 12px;height: 28px; width: 190px;padding: 4px;">
								<?php 
									$i=0;
									foreach ($typeassets as $value => $giatri)
									{
										?>
									<option value="<?php echo $giatri[0];?>" <?php if($type==$giatri[0]) echo 'selected="selected"';?> ><?php echo $giatri[1];?></option>
									<?php 
										$i++;
									}
														
									?>
								</select>
							</tr >		
							<tr >
								<td  class="tdfirst"><?php echo $l_nameassets;?></td>
								<td>
									<input type="text" name="nameAssets2" id="nameAssets2" readonly="readonly"  style="width:190px;float:left;height:20px;font-size: 13px;padding-left: 5px"  value="<?php echo $isBorrow[1];?>" />
								</td>
							</tr >			
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_using;?></td>
								<td>
									<select name="countAssets2" id="countAssets2" style="font-size: 12px;height: 28px; width: 50px;padding: 4px;">
									<option value="0" >0</option>
									<?php 
									for ($i=1; $i<=$isBorrow[2];$i++)
									{
										?>
									<option value="<?=$i?>" ><?=$i?></option>
									<?php 
									}
														
									?>
									</select>
								</td>
							</tr >
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_notused;?></td>
								<td>
									<select name="notuseAssets2" id="notuseAssets2" style="font-size: 12px;height: 28px; width: 50px;padding: 4px;">
									<option value="0" >0</option>
									<?php 
									for ($i=1; $i<=$isBorrow[3];$i++)
									{
										?>
									<option value="<?=$i?>" ><?=$i?></option>
									<?php 
									}
														
									?>
									</select>
								</td>
							</tr >
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_stock;?></td>
								<td>
									<select name="stockAssets2" id="stockAssets2" style="font-size: 12px;height: 28px; width: 50px;padding: 4px;">
									<option value="0" >0</option>
									<?php 
									for ($i=1; $i<=$isBorrow[4];$i++)
									{
										?>
									<option value="<?=$i?>" ><?=$i?></option>
									<?php 
									}
														
									?>
									</select>
								</td>
							</tr >
					</table>
					
<?php mysql_close($connection);?>